package com.cgbl.cg.vm.resource

import android.app.Application
import androidx.databinding.ObservableField
import com.robot.base.base.vm.GLBaseViewModel
import com.robot.base.model.ResourceDetailBean

class ResourceParamsViewModel(application: Application) : GLBaseViewModel(application) {
    val resourcesType = ObservableField<String>()
    val checkNumber = ObservableField<String>()
    val facesNumber = ObservableField<String>()
    val wiringType = ObservableField<String>()
    val uvType = ObservableField<String>()
    val isPrintable = ObservableField<String>()
    val binding = ObservableField(false)
    val carboon = ObservableField(false)
    val material = ObservableField(false)
    val plugin = ObservableField(false)
    val subside = ObservableField(false)
    val tietu = ObservableField(false)


    fun setData(bean: ResourceDetailBean) {

        checkNumber.set(bean.checkNumber)
        facesNumber.set(bean.facesNumber)
        binding.set(bean.binding == "1")
        carboon.set(bean.carboon == "1")
        material.set(bean.material == "1")
        plugin.set(bean.plugin == "1")
        subside.set(bean.subside == "1")
        tietu.set(bean.tietu == "1")
        resourcesType.set(
            when (bean.resourcesType) {
                "0" -> {
                    "3ds Max(.max)"
                }
                "1" -> {
                    "Blender(.blend)"
                }
                "2" -> {
                    "UE4Enginesketchup(.skp)"
                }
                "3" -> {
                    "OBJ(.obj)"
                }
                "4" -> {
                    "Maya(.ma)"
                }
                "5" -> {
                    "Zbrush(.ztl)"
                }
                "6" -> {
                    "Unity Engine"
                }
                "7" -> {
                    "FBX(.fbx)"
                }
                "8" -> {
                    "Cinema 4D(.c4d)"
                }
                "9" -> {
                    "Zbrush(.zpr)"
                }
                else -> {
                    ""
                }
            }
        )
        wiringType.set(
            when (bean.wiringType) {
                "0" -> {
                    "三角形"
                }
                "1" -> {
                    "四边形"
                }
                "2" -> {
                    "N边形"
                }
                "3" -> {
                    "三角形+四边形"
                }
                else -> {
                    "面片"
                }
            }
        )

        uvType.set(
            when (bean.uvType) {
                "0" -> {
                    "未展开"
                }
                "1" -> {
                    "已展开有重叠"
                }
                "2" -> {
                    "已展开不重叠"
                }
                else -> {
                    "混合"
                }
            }
        )
        isPrintable.set(
            if (bean.printable == "0") {
                "不可打印"
            } else {
                "可打印"
            }
        )
    }
}